﻿using System.Data;

using XianShang.Common;
using XianShang.Entity;
namespace XianShang.Data.DataProvider
{
   public class News
    {
        /// <summary>
        /// 增加一條新聞信息(來源為空時)
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static int AddNewsInfo(NewsInfo Ninfo)
        {
            return DatabaseProvider.GetInstance().AddNewsInfo(Ninfo);
        }

        /// <summary>
        /// 增加一條新聞信息(來源不為空時)
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static int AddNewsInfo1(NewsInfo Ninfo)
        {
            return DatabaseProvider.GetInstance().AddNewsInfo1(Ninfo);
        }

        /// <summary>
        /// 修改一條新聞信息（來源為空時）
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static int UpNewsInfo(string NewsTitle, string NewsContent, string NewsTimes, string Id)
        {
            return DatabaseProvider.GetInstance().UpNewsInfo(NewsTitle, NewsContent, NewsTimes, Id);
        }

        /// <summary>
        /// 修改一條新聞信息（來源不為空時）
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static int UpNewsInfo1(string NewsTitle, string NewsContent, string NewsFrom, string NewsTimes, string Id)
        {
            return DatabaseProvider.GetInstance().UpNewsInfo1(NewsTitle, NewsContent,NewsFrom, NewsTimes, Id);
        }

       /// <summary>
        /// 獲取信息顯示新聞列表
        /// </summary>
        /// <param name="isShow">顯示狀態（1顯示0不顯示）</param>
        /// <returns></returns>
        public static DataTable GetNewsInfo()
        {
            return Utils.DrToDt(DatabaseProvider.GetInstance().GetNewsInfo());
        }
        /// <summary>
        /// 獲取信息顯示新聞列表
        /// </summary>
        /// <param name="isShow">顯示狀態（1顯示0不顯示）</param>
        /// <param name="top">讀取條數</param>
        /// <returns></returns>
        public static DataTable GetNewsInfo(int top)
        {
            return Utils.LoadDataRows(DatabaseProvider.GetInstance().GetNewsInfo(),top,0);
        }
        /// <summary>
        /// 根據新聞ID刪除新聞信息
        /// </summary>
        /// <returns></returns>
        public static int DelNewsInfo(string NewId)
        {

            return DatabaseProvider.GetInstance().DelNewsInfo(NewId);
        }

        /// <summary>
        /// 獲取一條要修改的新聞信息顯示
        /// </summary>
        /// <returns></returns>
        public static NewsInfo GetNewsId(string NewId)
        {
            return DatabaseProvider.GetInstance().GetNewsId(NewId);
        }
        /// <summary>
        /// 更新新聞點擊量
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static int UpNewsHits(string id)
        {
            return DatabaseProvider.GetInstance().UpNewsHits(id);
        }
    }
}
